package com.faithnmn.learnenglish.util;

import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.support.v4.app.NotificationCompat;

import com.faithnmn.learnenglish.R;

public class NotificationHelper {
	private NotificationManager notifyManager;
    private NotificationCompat.Builder notifyBuilder;
    private Context context;
    private Bitmap largeIcon;
    private Bitmap giftIcon;
    public static final int NOTIFICATION_NEW_FEED = 2233;
    
    public NotificationHelper(Context context){
    	 this.context = context;
    	 notifyManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
         notifyBuilder = new NotificationCompat.Builder(context);
         largeIcon = BitmapFactory.decodeResource(context.getResources(), R.drawable.ic_launcher);
    }
    
    public void createNotification(boolean isOnGoing,int id, String title, String content, String ticker, PendingIntent pending){
    	notifyBuilder.setOngoing(isOnGoing);
        notifyBuilder.setTicker(ticker + " \"" + title + "\"");
        notifyBuilder.setSmallIcon(android.R.drawable.btn_plus);
        notifyBuilder.setLargeIcon(largeIcon);
	    notifyBuilder.setContentIntent(pending);
    	notifyBuilder.setContentText(content);
    	notifyBuilder.setContentTitle(title);
        notifyManager.notify(id, notifyBuilder.build());
    }
    
    public void cancel(int id){
    	notifyManager.cancel(id);
    }
}
